﻿#include "hoteldetailsinfo.h"
#include "ui_hoteldetailsinfo.h"

HotelDetailsInfo::HotelDetailsInfo(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::HotelDetailsInfo)
{
    ui->setupUi(this);
    m_watchImageDialog = nullptr;
}

HotelDetailsInfo::~HotelDetailsInfo()
{
    delete ui;
    if (m_watchImageDialog != nullptr)
    {
        delete m_watchImageDialog;
        m_watchImageDialog = nullptr;
    }
}

void HotelDetailsInfo::initWindowsUnit(const HotelInfo& hotelInfo)
{
    ui->lb_phone->setText(hotelInfo.getPhone());
    ui->lb_time->setText(hotelInfo.getDecoratedTime() + "装修" + hotelInfo.getOpenedTime() + "开业");
    ui->lb_intro->setText(hotelInfo.getDescription());
//    ui->lb_rule->setText(hotelInfo.getPhone());
}

void HotelDetailsInfo::on_pb_cred_clicked()
{
    if (m_watchImageDialog != nullptr)
    {
        delete m_watchImageDialog;
    }
    m_watchImageDialog = new WatchImageDialog();
    if (GlobalVars::g_hotelImageList.size() > 0)
    {
        m_watchImageDialog->setImage(GlobalVars::g_hotelImageList.at(0));
    }

    m_watchImageDialog->setWindowTitle("查看资质证书");
    m_watchImageDialog->setWindowModality(Qt::ApplicationModal);
    m_watchImageDialog->show();
}
